#include <stdio.h>  
  
long f(int n) {  
    if (n <= 0)  
        return 1;  
    return n * f(n - 1) + f (n - 2);  
}  
  
int main(void) {  
    int n;  
    if (scanf("%d", &n))  
        printf("%ld\n", f(n));  
    return 0;  
} 